﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows;

namespace personalplaner.common.converters
{
    public class BoolToInvertVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null && value is bool && (bool)value)
                return Visibility.Collapsed;

            return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null && value is Visibility && (Visibility)value == Visibility.Visible)
                return false;

            return true;
        }
    }
}
